﻿using JzSport.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace JzSport.Api
{
    /// <summary>
    /// 获取他人的活动列表
    /// </summary>
    class GetActivityCount4OtherAction : GetAction<Params.GetActivityCount4OtherParams,
        Results.GetActivityCount4OtherResult>
    {
        protected override ActionResult<Results.GetActivityCount4OtherResult> OnExecute(ActionContext context,
            SysParameters sysParameters,
            Params.GetActivityCount4OtherParams opParams)
        {
            ActivityService service = new ActivityService();

            Results.GetActivityCount4OtherResult actionResult = new Results.GetActivityCount4OtherResult();
            actionResult.FinishedCount = service.GetFinishedActivityCount4User(opParams.TargetId).Data;
            actionResult.UnfinishedCount = service.GetUnfinishedActivityCount4User(opParams.TargetId).Data;
            actionResult.CreatedCount = service.GetUnfinishedActivityCount4Creator(opParams.TargetId).Data;

            return new ActionResult<Results.GetActivityCount4OtherResult>("1.0.1", true, ErrorCode.NoError,
                        ErrorCode.ToString(ErrorCode.NoError), actionResult);
        }
    }
}
